-
-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ClassMetadata generic #2308
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I appreciate all the work you do here and in our other projects to document these generic classes! 💚
What do you think @franmomu, should we do another check for other generics in ODM before 2.3, or should we defer that to after our release?
# This cannot be solved the way it is, see https://github.com/vimeo/psalm/issues/5788 | ||
- | ||
message: "#^Return type \\(Doctrine\\\\ODM\\\\MongoDB\\\\Mapping\\\\ClassMetadataFactory\\) of method Doctrine\\\\ODM\\\\MongoDB\\\\DocumentManager\\:\\:getMetadataFactory\\(\\) should be compatible with return type \\(Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadataFactory\\<Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<object\\>\\>\\) of method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getMetadataFactory\\(\\)$#" | ||
count: 1 | ||
path: lib/Doctrine/ODM/MongoDB/DocumentManager.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not even going to pretend I understand half of what's going on here, but just to confirm I got this somewhat right: the problem is that we can't correctly say "this manager returns a class metadata factory which creates ORM metadata instances", is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, exactly, but in this case if I try to make ClassMetadataFactory
generic, I get an error from phpstan I guess because of this generic template of generic maybe.
From the top of the head maybe https://github.com/doctrine/mongodb-odm/blob/2.2.x/lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php and all iterators, but that could be some work, so maybe it's better to defer it after the release. Let me make my last PR in this branch for upgrading |
Thanks @franmomu! |
Summary
Following the changes from
doctrine/persistence
, this PR adds generics toClassMetadata
and toIterator
.